/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package gui;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 *
 * @author jt
 */
@Entity
@Table(name = "access_levels", catalog = "tgs", schema = "")
@NamedQueries({@NamedQuery(name = "AccessLevels.findAll", query = "SELECT a FROM AccessLevels a"), @NamedQuery(name = "AccessLevels.findById", query = "SELECT a FROM AccessLevels a WHERE a.id = :id"), @NamedQuery(name = "AccessLevels.findByAccessLevel", query = "SELECT a FROM AccessLevels a WHERE a.accessLevel = :accessLevel")})
public class AccessLevels implements Serializable {
    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "id")
    private Short id;
    @Basic(optional = false)
    @Column(name = "access_level")
    private String accessLevel;

    public AccessLevels() {
    }

    public AccessLevels(Short id) {
        this.id = id;
    }

    public AccessLevels(Short id, String accessLevel) {
        this.id = id;
        this.accessLevel = accessLevel;
    }

    public Short getId() {
        return id;
    }

    public void setId(Short id) {
        Short oldId = this.id;
        this.id = id;
        changeSupport.firePropertyChange("id", oldId, id);
    }

    public String getAccessLevel() {
        return accessLevel;
    }

    public void setAccessLevel(String accessLevel) {
        String oldAccessLevel = this.accessLevel;
        this.accessLevel = accessLevel;
        changeSupport.firePropertyChange("accessLevel", oldAccessLevel, accessLevel);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof AccessLevels)) {
            return false;
        }
        AccessLevels other = (AccessLevels) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "gui.AccessLevels[id=" + id + "]";
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }

}
